$(function () {
    $('#login').on('click', function () {
        const username = $('#username').val().trim()
        const password = $('#password').val().trim()
        // console.log(password, username);
        $.ajax({
            url: 'http://localhost:8080/api/v1/admin/user/login',
            type: 'post',
            data: {
                username,
                password
            },
            success: function (res) {
                // console.log(res);
                if (res.code === 200) {
                    localStorage.setItem('token', res.token)
                    location.href = 'index.html'
                } else {
                    alert(res.msg);

                }

            }

        })
    })
})